<%--
  Created by IntelliJ IDEA.
  User: ShiYan.Shi
  Date: 2018/11/14
  Time: 0:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/taglibs.jspf" %>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="sys.user.title"/></title>
    <meta name="decorator" content="list"/>
    <link rel="stylesheet" href="${staticPath}/css/font-awesome.min.css">
    <style>
        #middleContent .infoTable td {
            text-align: left;
            position: relative;
            padding: 1px 0px;
            min-height: 20px;
            line-height: 20px;
            /*font-size: 12px;*/
            font-weight: bold;
        }
        #middleContent li {
            /*font-size: 12px;*/
            font-weight: bold;
        }
        #middleContent .infoTable td input{
            width:100px;
        }
        .layui-textarea{
            font-size: 16px;
        }
    </style>
</head>
<body title="<spring:message code="sys.user.title" />">
<%--左侧病理取材信息列表  md3 25%--%>
<div id="leftContent" class="layui-col-md3">
    <div class="layui-tab layui-tab-card" lay-filter="listTab">
        <ul class="layui-tab-title">
            <%--默认选项卡--%>
            <li class="layui-this">未取材</li>
            <li>已取材</li>
        </ul>

    </div>
    <%--<div class="layui-tab-content">--%>
    <%--<form:form id="patientForm" modelAttribute="data" method="post" class="layui-form layui-form-pane"--%>
    <%--action="#">--%>
    <%--&lt;%&ndash;<form:hidden path="id" />&ndash;%&gt;--%>
    <%--<div class="layui-form-item">--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">在院区分</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--&lt;%&ndash;<form:select path="inhospital"  dict="isinhospital" htmlEscape="false" lay-verify="inhospital">&ndash;%&gt;--%>
    <%--&lt;%&ndash;</form:select>&ndash;%&gt;--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">是否冰冻</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--&lt;%&ndash;<form:select path="samfssampleid" dict="issamfssampleid" lay-verify="samfssampleid">&ndash;%&gt;--%>
    <%--&lt;%&ndash;</form:select>&ndash;%&gt;--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--<div class="layui-form-item">--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">患者姓名</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--<form:input path="patientName" lay-verify="patientName" class="layui-input"/>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">住院号</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--<form:input path="patientNum" lay-verify="patientNum" class="layui-input"/>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--<div class="layui-form-item">--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">登记人</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--<form:input path="recordName" lay-verify="recordName" class="layui-input"/>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--<div class="layui-inline">--%>
    <%--<label class="layui-form-label width-80">住院号</label>--%>
    <%--<div class="layui-input-block margin-left-80 width-100">--%>
    <%--<form:input path="applicationNum" lay-verify="applicationNum" class="layui-input"/>--%>
    <%--</div>--%>
    <%--</div>--%>
    <%--</div>--%>


    <%--</form:form>--%>
    <%--</div>--%>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show" id="patientListTab">
            <grid:grid id="patientList" rowNum="100" onSelectRow="patientListSelected" multiboxonly="false"
                       url="${appPath}/technician/material/ajaxList"  queryGroup="1" height="300">
                <grid:column label="sysmange.delaydays.delpathologyid" name="samPathologyId"  hidden="true"/><%--病种类别id--%>
                <grid:column label="sys.pathology.sampleid" name="id"  hidden="true"/><%--标本id--%>
                <grid:column label="sys.pathology.smallid" name="samChlPathologyId"  hidden="true"/><%--病种细类id--%>
                <grid:column label="sysmange.delaydays.delpathologyid" name="samPatientType"  hidden="true"/><%--患者类型1门诊2住院--%>
                <grid:column label="sys.sample.codenum" name="samBarcode"  hidden="true"/><%--标本条码号--%>
                <grid:column label="sys.thirdpart.codenum" name="samThirdBarcode"  hidden="true"/><%--第三方条码号--%>
                <grid:column label="sys.pathology.specimentype" name="samSampleClass" hidden="true"/><%--标本种类--%>
                <grid:column label="sys.technician.ismaterial" name="samIsPieces" hidden="true"/><%--是否取材--%>
                <grid:column label="sys.application.print" name="samIsPrint"  hidden="true"/><%--申请单是否打印(标本是否打印)--%>
                <%--<grid:column label="sys.application.number" name="requisitionNo"  hidden="true"/>&lt;%&ndash;申请单号&ndash;%&gt;--%>
                <grid:column label="sys.sample.status" name="samSampleStatus" /><%--标本状态--%>
                <grid:column label="sys.pathology.code" name="samPathologyCode"  query="true"/><%--病理编号--%>
                <grid:column label="patient.inhos.name" name="samPatientName"   /><%--患者姓名--%>
                <grid:column label="sys.patient.sex" name="samPatientSex"   /><%--患者性别--%>
                <grid:column label="sys.patient.age" name="samPatientAge"  /><%--患者年龄--%>
                <grid:column label="patient.age.unit" name="samPatientageType" hidden="true" /><%--年龄类型--%>
                <grid:column label="sys.patient.number" name="samPatientNumber"  /><%--住院门诊号--%>
                <grid:column label="apply.inspection.doctor" name="samReqDocName"   /><%--送检医生--%>
                <grid:column label="apply.inspection.hospital" name="samSendHospitalName"   /><%--送检单位--%>
                <grid:column label="apply.inspection.department" name="samSendDeptName"   /><%--送检科室--%>
                <grid:column label="sys.pathology.samfssampleid" name="samFsSampleId" /><%--是否冰冻--%>
                <grid:column label="sample.record.User" name="createUser"  /><%--登记人--%>
                <grid:column label="sample.record.date" name="createDate" query="true" /><%--登记时间--%>
            </grid:grid>
        </div>
    </div>

</div>
<%--中间取材操作页面  md6 --%>
<div id="middleContent" class="layui-col-md6">
    <div class="layui-tab layui-tab-card" lay-filter="listTab">
        <div class="layui-card-header">
            <label class="control-label no-padding-right">常用功能</label>
            <span class="btn-group" style="float: right"/>
            <div class="layui-col-md12 layui-fluid" >
                <div class="layui-form">
                    <div class="layui-form-item" style="margin-bottom: 0px !important;">
                        <div class="layui-input-inline" style="width: 78px !important;">
                            <div class="layui-input-inline" style="margin-right: 158px !important;">
                                <button class="layui-btn layui-btn-sm btn-xs"
                                        onclick="entry.sendNotice()">玻片打印</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 98px !important;">
                            <div class="layui-input-inline" style="margin-right: 158px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-info btn-xs"
                                        onclick="entry.printReport()">取材列表打印</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 98px !important;">
                            <div class="layui-input-inline" style="margin-right: 158px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-success btn-xs"
                                        onclick="entry.printReport()">取材记录打印</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 98px !important;">
                            <div class="layui-input-inline" style="margin-right: 158px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-inverse btn-xs"
                                        onclick="entry.printReport()">包埋盒打印-标</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 98px !important;">
                            <div class="layui-input-inline" style="margin-right: 158px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-normal btn-xs"
                                        onclick="entry.printReport()">包埋盒打印-材</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 48px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-warm btn-xs"
                                        onclick="entry.printReport()">一键制片</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-tab layui-tab-card" lay-filter="listTab">
        <div class="layui-card-header">
            <label class="control-label no-padding-right">取材人员</label>
            <span class="btn-group" style="float: right"/>
            <div class="layui-col-md12 layui-fluid" >
                <div class="layui-form">
                    <div class="layui-form-item" style="margin-bottom: 0px !important;">
                        <div class="layui-input-inline" style="width: 130px !important; margin-top: 9px">
                            <select name="operatingRoom" id="operatingRoom">
                                <option value="">选择取材医生</option>
                                <c:forEach var="item" items="${operatingRoomList}">
                                    <option value="${item.code}">${item.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 130px !important; margin-top: 9px">
                            <select name="operatingRoom" id="operatingRoom">
                                <option value="">选择录入人员</option>
                                <c:forEach var="item" items="${operatingRoomList}">
                                    <option value="${item.code}">${item.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 48px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-warm btn-xs"
                                        onclick="entry.printReport()">设置默认</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-tab layui-tab-card" lay-filter="listTab">
        <div class="layui-card-header">
            <label class="control-label no-padding-right">患者申请信息</label>
            <span class="btn-group" style="float: right"/>
            <div class="layui-col-md12 layui-fluid" >
                <div class="layui-form">
                    <div class="layui-form-item" style="margin-bottom: 0px !important;">
                        <div class="layui-input-inline" style="width: 78px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm btn-xs"
                                        onclick="entry.sendNotice()">计费调整</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 78px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-info btn-xs"
                                        onclick="entry.printReport()">计费查看</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 78px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-success btn-xs"
                                        onclick="entry.printReport()">查看申请</button>
                            </div>
                        </div>
                        <div class="layui-input-inline" style="width: 48px !important;">
                            <div class="layui-input-inline" style="margin-right: 78px !important;">
                                <button class="layui-btn layui-btn-sm layui-btn-warm btn-xs"
                                        onclick="entry.printReport()">查看冰冻</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-fluid">
            <div id="patientInfo">
                <form:form modelAttribute="apply" method="post" class="layui-form"
                           lay-filter="component-form-group">
                    <table class="infoTable" style="width: 100%">
                        <colgroup>
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col width="10%">
                            <col>
                        </colgroup>
                        <tbody>
                        <tr>
                            <td>姓&emsp;&emsp;名：</td>
                            <td><input name="samPatientName" type="text" class="patientInfo" disabled="disabled" readonly="true" style="width: 100px"/></td>
                            <td>性&emsp;&emsp;别：</td>
                            <td><input type="text" name="samPatientSex" class="patientInfo" disabled="disabled" readonly="true" style="width: 100px"/></td>
                            <td>申请科室：</td>
                            <td><input type="text" name="samSendHospitalName" class="patientInfo" disabled="disabled" readonly="true" style="width: 100px"/></td>
                            <td>床&ensp;位&ensp;号：</td>
                            <td><input type="text" name="samPatientBed" class="patientInfo" disabled="disabled" readonly="true" style="width: 100px"/></td>
                        </tr>
                        <tr>
                            <td>病理编号：</td>
                            <td><input type="text" name="samAuditer" class="patientInfo" disabled="disabled" readonly="true"/></td>
                            <td>年&emsp;&emsp;龄：</td>
                            <td><input type="text" name="samPatientAge" class="patientInfo" disabled="disabled" readonly="true"/></td>
                            <td>申请医生：</td>
                            <td><input type="text" name="samReqDocName" class="patientInfo" disabled="disabled" readonly="true"/></td>
                            <td>性&emsp;&emsp;别：</td>
                            <td><input type="text" name="samPatientSex" class="patientInfo" disabled="disabled" readonly="true"/></td>
                        </tr>
                        <tr>
                            <td>门诊住院号：</td>
                            <td><input type="text" name="samPatientNumber" class="patientInfo" disabled="disabled" readonly="true"/></td>
                            <td>送检材料：</td>
                            <td ><input type="text" name="samSampleName" class="patientInfo" disabled="disabled" readonly="true" /></td>
                            <td>手术所见：</td>
                            <td colspan="3"><input type="text" name="samOpsShow" class="patientInfo" disabled="disabled" readonly="true" style="width: 96.5%"/></td>
                        </tr>
                        <tr>
                            <td>临床诊断：</td>
                            <td colspan="3"><input type="text" name="samDignoses" class="patientInfo double-size" disabled="disabled" readonly="true" style="width: 96.5%"/></td>
                            <td>送检单位：</td>
                            <td colspan="3"><input type="text" name="samSendHospitalName" class="patientInfo double-size" disabled="disabled" readonly="true" style="width: 96.5%"/></td>
                        </tr>
                        </tbody>
                    </table>
                </form:form>
            </div>
        </div>
    </div>
    <div class="layui-tab layui-tab-card" lay-filter="listTab">
        <div class="layui-col-md12">
            <div class="layui-tab layui-tab-card" lay-filter="showtab">
                <ul class="layui-tab-title">
                    <li class="layui-this">巨检所见</li>
                    <li>巨检诊断</li>
                    <li>巨检图像</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show" style="height: 200px;">
                        <div class="layui-form-item layui-form-text">
                            <div>
                                <textarea id="samjjsj" placeholder="" class="layui-textarea"   style="height: 200px;"></textarea>
                            </div>
                        </div>

                    </div>
                    <div class="layui-tab-item" style="height: 200px;">
                        <div>
                            <textarea id="samjjzd" placeholder="" class="layui-textarea"   style="height: 200px;"></textarea>
                        </div>
                    </div>
                    <div class="layui-tab-item" style="height: 200px;">
                        <div>
                            <textarea id="samjjtx"  placeholder="" class="layui-textarea layui-hide" name="content"  ></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-tab layui-tab-card" lay-filter="listTab">

    </div>
</div>
<%--右侧模版选择  md3 --%>
<div id="rightContent" class="layui-col-md3">

</div>
<script>
    var lastApplyId
    var lastPatientId
    var windowsHeight = document.documentElement.clientHeight; //页面高度
    var bigWidth
    var bigHeight
    var shortWidth
    var shortHeight
    var detailSwitch = true;
    var changeCount = 0;
    /*
    * layui form样式初始化
    * */
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        form.on('select(bloodDeptSelect)', function (data) {
            $("#bloodDeptEvaluation").val($("#bloodDeptEvaluation").val() + "，" + data.value)
            form.render();
        });

        //监听指定开关
        form.on('switch(showDetail)', function (data) {
            if (this.checked) {
                showDetailSize()
                detailSwitch = true;
                $("input[name='close']").prop('checked', 'checked');  //改变开关为 开
                form.render('checkbox')
            } else {
                hideDetailSize()
                detailSwitch = false;
                $("input[name='close']").removeAttr('checked');  //改变开关为 关
                form.render('checkbox')
            }
        });


    })

    /*
    * tab切换相应事件
    * */
    layui.use('element', function () {
        var $ = layui.jquery,
            form = layui.form
        element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
        //申请详细信息tab切换监听
        element.on('tab(listTab)', function (data) {
            switch (data.index) {
                case 0:
                    showDetailSize()
                    detailSwitch = true;
                    $("input[name='close']").prop('checked', 'checked');  //改变开关为 开
                    form.render('checkbox')
                    break;
                default:
                    break
            }

        });
        //申请详细信息tab切换监听
        element.on('tab(detailTab)', function (data) {
            switch (data.index) {
                case 0:
                    getBloodDetailTab()
                    break;
                case 1:
                    getTransfusionTab()
                    break;
                case 2:
                    getFeedbackTab()
                    break;
                case 3:
                    getAfterEvaluation()
                    break;
                default:
                    break
            }

        });
    });

    $(function () {
        /*
        *载入页面各个表格宽度和高度修正
         */
        var leftHeight = windowsHeight - $("#applyListGridQuery").height() - 170;
        var leftWidth = $("#gbox_applyListGrid").width();
        $("#applyListGrid").setGridHeight(leftHeight);
        shortWidth = leftWidth;
        shortHeight = leftHeight;
        var rightWidth = $("#rightContent").width();

        $("#leftContent #applyListTab .pull-left").append("" +
            "<form class='layui-form' style='display: inline !important;'>" +
            "<div class='layui-form-item' style='display: inline !important;'>" +
            "<div class='layui-input-inline' style='float: none !important;width: 60px'> " +
            "<input type='checkbox' checked='' class='detailSwitch' id='showDetail' name='close' lay-skin='switch' lay-filter='showDetail' lay-text='详情|隐藏'> </div> " +
            "</div></form>");

    });


    /*
    病人列表选中事件
    */
    function patientListSelected(rowid, iRow, iCol, e) {
        var patientIds = $("#patientListGrid").jqGrid("getGridParam", "selarrrow");
        leftListSelected(patientIds, "");

    }

    /*
    申请列表选中事件
    */
    function applyListSelected(rowid, iRow, iCol, e) {
        var applyIds = $("#applyListGrid").jqGrid("getGridParam", "selarrrow");
        leftListSelected('', applyIds);

    }

    /*
    申请记录表选中事件
    */
    function applyRecordListSelected(rowid, iRow, iCol, e) {
        var rowData = $("#applyRecordListGrid").jqGrid('getRowData', rowid);
        lastApplyId = rowData.applyId;
        lastPatientId = rowData.patientId;
        $("#applyDetailListGrid").clearGridData()
        getPatientInfo()
        if(rowData.isPrint==1){
            getVersionNo(lastApplyId)
        }
        if ($("#bloodDetailTab").hasClass("layui-show")) {
            getBloodDetailTab(rowData.bloodReason)
        }
        if ($("#bloodInfusionTab").hasClass("layui-show")) {
            getTransfusionTab()
        }
        if ($("#feedBackTab").hasClass("layui-show")) {
            getFeedbackTab()
        }

        if ($("#afterEvaluationTab").hasClass("layui-show")) {
            getAfterEvaluation()
        }

    }

    /**
     * 获取病人信息
     */
    function getPatientInfo(){
        var versionNo = $("#versionNo").val() || ''
        //获取病人信息
        $.ajax({
            type: "GET",
            dataType: "json",
            data: {
                applyId: lastApplyId,
                patientId: lastPatientId,
                versionNo: versionNo
            },
            url: baseUrl + "/apply/normal/getPatientInfo",
            success: function (data) {
                if (data.patient != undefined) {
                    setValue("table .patientInfo", data.patient)
                }
            }
        })
    }

</script>
</body>
</html>
